import Vue from 'vue'
import App from './App'
import store from './store'  

import {ColorList} from './utils/constant.js'

// 全局组件
import home from './pages/home/index.vue'
import order from './pages/order/index.vue'
import about from './pages/about/index.vue'
import cuCustom from './components/cu-custom.vue'
import coursePanel from './components/course-panel.vue'
import branch from './components/branch.vue'
import vipCard from './components/vip-card.vue'
import chart from './components/chart.vue'

Vue.component('home',home)
Vue.component('order',order)
Vue.component('about',about)
Vue.component('cu-custom',cuCustom)
Vue.component('course-panel',coursePanel)
Vue.component('branch',branch)
Vue.component('vip-card',vipCard)
Vue.component('chart',chart)

Vue.config.productionTip = false

App.mpType = 'app'

// 实现promise的finally
Promise.prototype.finally = function (callback) {
	let P = this.constructor;
	return this.then(
		value => P.resolve(callback()).then(() => value),
		reason => P.resolve(callback()).then(() => { throw reason })
	)
}
// 全局的方法
Vue.prototype.$showToast = function showToast(text) {
	uni.showToast({
		title: text,
		icon: 'none'
	})
}
Vue.prototype.$showLoading = function showLoading(text) {
	uni.showLoading({
	  title: text || '加载中',
	  icon: 'loading'
	})
}
Vue.prototype.$hideLoading = function hideLoading(text) {
	uni.hideLoading()
}

// 全局常量
Vue.prototype.ColorList = ColorList

Vue.prototype.$store = store

const app = new Vue({
    ...App
})
app.$mount()

 



